﻿namespace CustomCache;

public class DataDownloader:IDataDownloader
{
    private readonly Cache<string, string> _cache = new();
    
    
    public string DownloadData(string resourceId)
    {
        return _cache.Get(resourceId, DownloadDataWithoutCaching);
    }
    
    private string DownloadDataWithoutCaching(string resourceId)
    {
        Thread.Sleep(1000);
        return $"Some data for {resourceId}";
    }
}